package com.food.restaurantpro.utils;

import com.food.restaurantpro.RestaurantApp;

import android.widget.Toast;

public class Utils {
	public static boolean isEmpty(String input) {
		if(input == null || input.equals("")) {
			return true;
		}
		return false;
	}
	
	public static void showToast(String message) {
		Toast.makeText(RestaurantApp.getInstance(), message, Toast.LENGTH_LONG).show();;
	}
	
	public static boolean isValidEmail(String target) {
	    if (target == null) {
	        return false;
	    } else {
	        return android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches();
	    }
	}
	
	public static String getStandardTime(int Hour, int Minute) {
		String HH = Hour < 10 ? ("0" + Hour) : ("" + Hour);
		String MM = Minute < 10 ? ("0" + Minute) : ("" + Minute);
		return HH + ":" + MM;
	}
	
	public static String getStandardDate(int Day, int Month, int Year) {
		String DD = Day < 10 ? ("0" + Day) : ("" + Day);
		String MM = Month < 10 ? ("0" + Month) : ("" + Month);
		String YYYY = "" + Year;
		return DD + "/" + MM + "/" + YYYY;
	}
}
